﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Librerias;

namespace eCampusWeb
{
    public partial class Red : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["correo"] == null || Session["correo"].ToString() == "")
            {
                Response.Redirect("~/401.aspx");
            }

            if (!IsPostBack)
            {
                try
                {
                    DataTable datos = new ENUsuario().MiRed(Session["correo"].ToString(), Convert.ToInt32(Session["tipo"]));
                    ListView2.DataSource = datos;
                    ListView2.DataBind();

                    lbNum.Text = datos.Rows.Count.ToString();
                }
                catch (Exception) 
                { 

                }
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {

            try
            {
                ListView2.DataSource = new ENUsuario().MiRedBuscar(Session["correo"].ToString(), Convert.ToInt32(Session["tipo"]),TextBox1.Text);
                ListView2.DataBind();
            }
            catch (Exception)
            {
            }
        }
        
    }
}